<?php if ( ! defined('ABS_PATH')) exit('ABS_PATH is not loaded. Direct access is not allowed.');
    

    if( !defined('__FROM_CRON__') ) {
        define('__FROM_CRON__', true);
    }

    function purge_latest_searches_daily() {
        $purge = osc_purge_latest_searches();
        if($purge == 'day') {
            LatestSearches::newInstance()->purgeDate(date('Y-m-d H:i:s', (time()-(24*3600))));
        } else if($purge == 'week') {
            LatestSearches::newInstance()->purgeDate(date('Y-m-d H:i:s', (time()-(7*24*3600))));
        }
    }

    osc_add_hook('cron_daily', 'purge_latest_searches_daily');
    osc_runAlert('DAILY');

    osc_run_hook('cron_daily');

?>